﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace EduseKiosk
{
    public partial class NavBar : UserControl
    {
        public NavBar()
        {
            InitializeComponent();
        }

        public void Reload()
        {
            FormEduseKiosk form = FormEduseKiosk.Instance;

            if (form.ActiveViewControl == null)
                return;

            if (form.ActiveViewControl.UpperControl == null)
                buttonUp.Visible = false;
            else
                buttonUp.Visible = true;

            if (form.ActiveViewControl.PreviousControl == null)
                buttonLeftNav.Visible = false;
            else
                buttonLeftNav.Visible = true;

            if (form.ActiveViewControl.NextControl == null)
                buttonRightNav.Visible = false;
            else
                buttonRightNav.Visible = true;
        }

        private void NavBar_Load(object sender, EventArgs e)
        {
            Reload();
        }

        private void buttonUp_Click(object sender, EventArgs e)
        {
            FormEduseKiosk form = FormEduseKiosk.Instance;

            form.SwitchToView(form.ActiveViewControl.UpperControl);
        }

        private void buttonRightNav_Click(object sender, EventArgs e)
        {
            FormEduseKiosk form = FormEduseKiosk.Instance;

            form.SwitchToView(form.ActiveViewControl.NextControl);
        }

        private void buttonLeftNav_Click(object sender, EventArgs e)
        {
            FormEduseKiosk form = FormEduseKiosk.Instance;

            form.SwitchToView(form.ActiveViewControl.PreviousControl);
        }
    }
}
